//
//  WithDrawalCommissionView.m
//  GLGW_Shoping
//
//  Created by whx on 2018/12/5.
//  Copyright © 2018年 yang. All rights reserved.
// 佣金提现最上面的提示条

#import "WithDrawalCommissionView.h"
#import "RunLabelView.h"

@implementation WithDrawalCommissionView

- (id)initWithFrame:(CGRect)aFrame inSuperView:(UIView *)aSuperView
{
    if (self = [super initWithFrame:aFrame inSuperView:aSuperView]) {
        self.backgroundColor = [UIColor colorWithHexString:@"#F2F2F2"];
        
        GLGWView *View = [[GLGWView alloc] initWithInSuperView:self];
        [View mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self);
            make.left.right.equalTo(self);
            make.height.equalTo(@(aFrame.size.height));
        }];
        View.backgroundColor = [UIColor colorWithHexString:@"#A89A60" alpha:0.4];
        
        GLGWImageView *imgV = [[GLGWImageView alloc] initWithImageName:@"icon_laba" inSuperView:View];
        [imgV mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self).offset(kWidthProportion_In_iPhoneTriploid(15));
            make.centerY.equalTo(self.mas_centerY);
            make.height.with.equalTo(@(kWidthProportion_In_iPhoneTriploid(14)));
        }];
        
        GLGWButton *deletBtn = [[GLGWButton alloc] initWithTitle:@"" titleLableFont:SYSTEMFONT(16) titleLableColor:[UIColor colorWithHexString:@"#A89A60"] inSuperView:View];
        [deletBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(View.mas_right).offset(-kWidthProportion_In_iPhoneTriploid(3));
            make.centerY.equalTo(imgV.mas_centerY);
            make.width.equalTo(@(kWidthProportion_In_iPhoneTriploid(36)));
            make.height.equalTo(View.mas_height);
        }];
        [deletBtn addTarget:self action:@selector(deletBtnAction:) forControlEvents:UIControlEventTouchUpInside];
        [deletBtn setImage_Name:@"icon_quxiao_bai"];
        
        if (KScreenWidth == 320.0f) {
            
            RunLabelView *runView = [[RunLabelView alloc] initWithFrame:CGRectMake(kWidthProportion_In_iPhoneTriploid(36), 0, KScreenWidth - kWidthProportion_In_iPhoneTriploid(36 + 39), aFrame.size.height) inSuperView:View];
            runView.messageArray = @[@"每周三结算上周预估收入，本周预估收入则在下",@"周三结算"];
            [runView setScrollDuration:0.5 stayDuration:2];
            runView.backgroundColor = [UIColor clearColor];
            [runView changeTapMarqueeAction:^(NSInteger index) {
                NSLog(@"你点击了第 %ld 个button！", index);
            }];
            [runView start];
        } else {
            GLGWLabel *lab1 = [[GLGWLabel alloc] initWithFont:SYSTEMFONT(12) theColor:[UIColor colorWithHexString:@"#EC5353"] inSuperView:View];
            [lab1 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(imgV.mas_right).offset(kWidthProportion_In_iPhoneTriploid(2));
                make.centerY.equalTo(imgV.mas_centerY);
                make.right.equalTo(View.mas_right).offset(kWidthProportion_In_iPhoneTriploid(39));
            }];
            lab1.text = @"每周三结算上周预估收入，本周预估收入则在下周三结算";
        }

    }
    return self;
}

- (void)deletBtnAction:(GLGWButton *)sender
{
    if (self.BlockDelete) {
        self.BlockDelete(sender);
    }
}

@end
